<template>
  <div class="userRoot">
    <div class="userHeader">
      <img :src="userData.icon" v-if="userData.icon" class="touxiang" alt="" />
      <img
        src="@/static/Imgs/userImg/touxiang.png"
        v-else
        class="touxiang"
        alt=""
      />
      <div class="userData">
        <div class="userPhone">{{ userData.username }}</div>
        <div class="userName">采购商</div>
      </div>
    </div>
    <div class="editBox" @click="$router.push('/PersonalData')">
      <i class="el-icon-edit"></i>
      修改资料
    </div>
    <div class="formBox">
      <div class="formList">
        <div class="formName">注册时间</div>
        <div class="formValue">{{ userData.createTime }}</div>
      </div>
      <div class="formList">
        <div class="formName">登录账号</div>
        <div class="formValue">{{ userData.phone }}</div>
      </div>
      <div class="formList">
        <div class="formName">手机号</div>
        <div class="formValue">{{ userData.phone }}</div>
      </div>
      <!-- <div class="formList">
        <div class="formName">微信号</div>
        <div class="formValue">
          未填写 <span class="FillOut">去设置>></span>
        </div>
      </div> -->
    </div>
    <div class="CustomerService">
      <div class="wechatBox">
        <div class="wachatTitle">平台微信客服</div>
        <div class="sweep">（微信扫一扫，在线咨询）</div>
        <img src="@/assets/image/help/icon5.png" class="erweima" alt="" />
      </div>
    </div>
    <div class="HelpCenter">
      <div class="helpTitle">帮助中心</div>
      <div
        class="helpList"
        v-for="(item, index) in newLsit"
        :key="index"
        @click="
          $router.push({
            path: '/helpDetails',
            query: {
              id: id,
              index: 1,
            },
          })
        "
      >
      {{ item.name }}
      </div>
    
      <div class="more" @click="
            $router.push({
              path: '/HelpCenter',
              query: {
                index: 1,
              },
            })
          ">
        查看更多 <i class="el-icon-arrow-down"></i>
      </div>
    </div>
  </div>
</template>

<script>
import { selectAboutUs, selectHelpCenter } from "@/api/HelpCenter";
import { watch } from "vue";
export default {
  props: {
    userData: {
      type: Object,
    },
  },
  data() {
    return {
      newLsit: [],
    };
  },
  created(){
    this.selectHelpCenter()
  },
  mounted() {},
  methods:{
    selectHelpCenter() {
      selectHelpCenter().then((data) => {
        this.newLsit = data.data.slice(0, 5);
      });
    },
  },
  watch: {},
};
</script>

  <style scoped lang="scss">
.userRoot {
  font-size: 0.5vw;
  margin-left: 2.5vw;
  padding-top: 20px;
  width: 16vw;
  .userHeader {
    display: flex;
    align-items: center;
    .touxiang {
      width: 2.5vw;
      height: 2.5vw;
      border-radius: 50%;
    }
    .userData {
      margin-left: 0.5vw;
      .userPhone {
        font-size: 16px;
        color: #333;
        font-weight: 500;
      }
      .userName {
        font-size: 0.5vw;
        color: rgba(51, 51, 51, 0.6);
        margin-top: 3px;
        font-weight: 400;
      }
    }
  }
  .editBox {
    width: 5vw;
    margin-top: 20px;
    margin-left: 4vw;
    border-radius: 20px;
    font-size: 0.5vw;
    color: #333;
    padding: 6px 10px;
    text-align: center;
    border: 1px solid #e8e8e8;
    cursor: pointer;
  }
  .editBox:hover {
    border: 1px solid #e22a1f;
    color: #e22a1f;
  }
  .formBox {
    margin-top: 20px;
    .formList {
      margin-bottom: 15px;
      display: flex;
      justify-content: space-between;
      .formName {
        font-size: 0.8vw;
        color: #333;
      }
      .formValue {
        font-size: 0.7vw;
        color: rgba(51, 51, 51, 0.6);
        .FillOut {
          color: #ff4d6d;
          margin-left: 10px;
          cursor: pointer;
        }
      }
    }
  }
  .CustomerService {
    margin-top: 40px;
    background: #f4fff3;
    display: flex;
    justify-content: center;
    border-radius: 12px;
    .wechatBox {
      margin-top: 30px;
      text-align: center;
      .wachatTitle {
        font-size: 0.6vw;
        font-weight: 700;
      }
      .sweep {
        color: #333333;
        font-size: 0.5vw;
        margin-top: 10px;
      }
      .erweima {
        width: 160px;
        margin-top: 10px;
      }
    }
  }
  .HelpCenter {
    margin-top: 20px;
    background: #f3feff;
    padding: 30px 10px;
    .helpTitle {
      font-size: 0.6vw;
      font-weight: 700;
      text-align: center;
    }
    .helpList {
      background: #fff;
      padding: 10px;
      font-size: 0.7vw;
      color: #333333;
      margin: 10px 0;
      border-radius: 4px;
    }
    .more {
      margin-top: 10px;
      color: rgba(51, 51, 51, 0.6);
      font-size: 0.6vw;
      text-align: center;
      cursor: pointer;
    }
  }
}
</style>
